/**
 * 请求球员列表
 */

export const fetchPlayerListData = function (data = {}) {
  console.log("请求球员列表", data);
  return new Promise((resolve) => {
    setTimeout(() => {
      resolve({
        code: 1,
        data: {
          total: 8,
          items: [
            {
              id: 10001,
              name: "张三",
              position: 1001,
              clothNumber: 26,
              age: 21,
              price: 100,
              subScore: 491,
              status: 1,
            },
            {
              id: 10002,
              name: "张三1",
              position: 1002,
              clothNumber: 26,
              age: 21,
              price: 100,
              subScore: 491,
              status: 1,
            },
            {
              id: 10003,
              name: "张三2",
              position: 2001,
              clothNumber: 26,
              age: 21,
              price: 100,
              subScore: 491,
              status: 2,
            },
            {
              id: 10004,
              name: "张三3",
              position: 2002,
              clothNumber: 26,
              age: 21,
              price: 100,
              subScore: 491,
              status: 1,
            },
            {
              id: 10014,
              name: "张三4",
              position: 3001,
              clothNumber: 26,
              age: 21,
              price: 100,
              subScore: 491,
              status: 2,
            },
            {
              id: 10024,
              name: "张三5",
              position: 3002,
              clothNumber: 26,
              age: 21,
              price: 100,
              subScore: 491,
              status: 1,
            },
            {
              id: 10005,
              name: "张三6",
              position: 3003,
              clothNumber: 26,
              age: 21,
              price: 100,
              subScore: 491,
            },
            {
              id: 10005,
              name: "张三7",
              position: 4000,
              clothNumber: 26,
              age: 21,
              price: 100,
              subScore: 491,
            },
          ],
        },
      });
    }, 800);
  });
};

/**
 * 请求球员详细信息
 */

export const fetchPlayerDetailData = function (data = {}) {
  console.log("请求球员详细信息", data);
  return new Promise((resolve) => {
    setTimeout(() => {
      resolve({
        code: 1,
        data: {
          id: 10001,
          name: "张三",
          height: 173.23,
          weight: 89.32,
          age: 21,
          clothNumber: 23,
          price: 100,
          position: 1002,
          // position: 4000,
          // 非守门员字段
          attackScore: 80, // 进攻分
          resistScore: 78, // 对抗分
          speedScore: 89, // 速度分
          dribblingScore: 92, // 盘带分,
          powerScore: 80, // 力量分
          defendScore: 72, // 防守分
          // 守门员字段
          handballScore: 89, // 手抛球分
          freeKickScore: 80, // 任意球分
          dribbleScore: 71, // 远射分
          closeRangeScore: 72, // 近距离分
          penaltyScore: 89, // 点球分
          reactiveScore: 67, // 反应分
          // 签约状态
          status: 1,
        },
      });
    }, 800);
  });
};

/**
 * 请求球员相关的比赛信息 无分页
 */
export const fetchPLayerRaceListData = function (data = {}) {
  console.log("请求球员相关的比赛信息", data);
  return new Promise((resolve) => {
    setTimeout(() => {
      resolve({
        code: 1,
        data: [
          {
            id: 1000001,
            score: 1,
            startTime: new Date("2024-01-01 14:00:00").getTime(),
            endTime: new Date("2024-01-01 16:01:23").getTime(),
            position: 1001,
            time: 24.4,
            otherTeamName: "天天向上队",
          },
          {
            id: 1000002,
            score: 2,
            startTime: new Date("2024-01-02 14:00:00").getTime(),
            endTime: new Date("2024-01-02 16:01:23").getTime(),
            position: 1001,
            time: 40.4,
            otherTeamName: "天天向上队1",
          },
          {
            id: 1000003,
            score: 0,
            startTime: new Date("2024-01-03 14:00:00").getTime(),
            endTime: new Date("2024-01-03 16:01:23").getTime(),
            position: 1001,
            time: 12.1,
            otherTeamName: "天天向上队2",
          },
          {
            id: 1000004,
            score: 2,
            startTime: new Date("2024-01-04 14:00:00").getTime(),
            endTime: new Date("2024-01-04 16:01:23").getTime(),
            position: 1001,
            time: 19.2,
            otherTeamName: "天天向上队3",
          },
        ],
      });
    });
  });
};

/**
 * 改变球员签约状态
 */

export const fetchPlayerStatusChange = function (data = {}) {
  console.log("改变球员签约状态", data);
  return new Promise((resolve) => {
    setTimeout(() => {
      resolve({ code: 1, data: true });
    }, 800);
  });
};

/**
 * 删除球员
 */
export const fetchPlayerDelete = function (data = {}) {
  console.log("删除球员", data);
  return new Promise((resolve) => {
    setTimeout(() => {
      resolve({ code: 1, data: true });
    }, 800);
  });
};

/**
 * 新增球员
 */
export const fetchPlayerAdd = function (data = {}) {
  console.log("新增球员", data);
  return new Promise((resolve) => {
    setTimeout(() => {
      resolve({ code: 1, data: true });
    }, 800);
  });
};

/**
 * 更新球员
 */
export const fetchPlayerEdit = function (data = {}) {
  console.log("编辑球员", data);
  return new Promise((resolve) => {
    setTimeout(() => {
      resolve({ code: 1, data: true });
    }, 800);
  });
};

/**
 * 请求所有队员 (下拉备选)
 */

export const fetchPLayerOptions = function (data = {}) {
  console.log("请求所有队员 (下拉备选)", data);
  return new Promise((resolve) => {
    setTimeout(() => {
      resolve({
        code: 1,
        data: [
          {
            id: 10001,
            name: "张三",
            position: 1001,
            clothNumber: 26,
            age: 21,
            price: 100,
            subScore: 491,
            status: 1,
          },
          {
            id: 10002,
            name: "张三1",
            position: 1002,
            clothNumber: 26,
            age: 21,
            price: 100,
            subScore: 491,
            status: 1,
          },
          {
            id: 10003,
            name: "张三2",
            position: 2001,
            clothNumber: 26,
            age: 21,
            price: 100,
            subScore: 491,
            status: 2,
          },
          {
            id: 10004,
            name: "张三3",
            position: 2002,
            clothNumber: 26,
            age: 21,
            price: 100,
            subScore: 491,
            status: 1,
          },
          {
            id: 10014,
            name: "张三4",
            position: 3001,
            clothNumber: 26,
            age: 21,
            price: 100,
            subScore: 491,
            status: 2,
          },
          {
            id: 10024,
            name: "张三5",
            position: 3002,
            clothNumber: 26,
            age: 21,
            price: 100,
            subScore: 491,
            status: 1,
          },
          {
            id: 10090,
            name: "张三6",
            position: 3003,
            clothNumber: 26,
            age: 21,
            price: 100,
            subScore: 491,
          },
          {
            id: 10005,
            name: "张三7",
            position: 4000,
            clothNumber: 26,
            age: 21,
            price: 100,
            subScore: 491,
          },
        ],
      });
    }, 800);
  });
};
